package datatype

/**
 * @author: kevin  
 * @date: 20:57 2021/4/29
 */
object UnitNullNothingDemo {

  //Unit等价于java的void，只有一个实例值()
  def sayHello() = {
  }

  def main(args: Array[String]): Unit = {
    val res = sayHello
    println("res = " + res)

    //Null类只有一个示例对象，null，类似于java中的null引用。null可以赋值给任意引用类型(AnyRef)，但是
    //不能赋给值类型(AnyVal: 比如 Int, Float, Char, Boolean, Long, Double, Byte, Short)
    val dog: Dog = null
    //an expression of type Null is ineligible for implicit conversion
    //val char1: Char = null
    println("ok~~~")
  }
}

class Dog{

}
